﻿/// <summary>
/// https://leetcode-cn.com/problems/two-sum/
/// </summary>
public class Solution
{
    public int[] TwoSum(int[] nums, int target)
    {
        for (int firstIndex = 0; firstIndex < nums.Length; firstIndex++)
        {
            int aimValue = target - nums[firstIndex];
            int aimIndex = Array.IndexOf(nums, aimValue);
            if (aimIndex != -1 && aimIndex != firstIndex)
                return new int[] { firstIndex, aimIndex };
        }
        throw new Exception();
    }
}